/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Vectors;

import Vectors.MultiThreding.OneReadThread;
import Vectors.MultiThreding.OneWriteThread;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author netcracker
 */
public class Keeper extends Thread{

    private IVector vector;
    private OneReadThread ort;
    private OneWriteThread owt;
    private Thread ortThread;
    private Thread owtThread;
    private boolean edited;
    public Keeper(IVector vector) {
        this.vector = vector;
        ort = new OneReadThread(this);
        owt = new OneWriteThread(this);
        ortThread = new Thread(ort);
        owtThread = new Thread(owt);
    }

    @Override
    public synchronized void run() {
            owtThread.start();
            ortThread.start(); 
    }
    
        
    public Double get(int id) {
        return vector.get(id);
    }

    
    public void set(double value, int position) {
        vector.set(value, position);
    }
    
        public int getLength() {
        return vector.getLength();
    }

    public void setEdited(boolean edited) {
        this.edited = edited;
    }

    public boolean isEdited() {
        return edited;
    }
}